package structuralModel.decoratorModel;

/**
 * 功能描述: 装饰器模式测试
 * 2024/02/09
 * <p>
 * ZhangYi
 */
public class decoratorModelClient {
    public static void main(String[] args){
        System.out.println("=============黑咖啡===============");
        // 初始化黑咖啡
        Drink drink = new BlackCoffee();
        System.out.println(drink.getDesc());

        // 黑咖啡中 添加 一份牛奶
        drink = new Milk(drink);
        System.out.println(drink.getDesc());
        // 黑咖啡中 添加一份冰激凌
        drink = new IceCream(drink);
        System.out.println(drink.getDesc());
        // 黑咖啡中 添加2分巧克力
        drink = new Chocolate(drink);
        drink= new Chocolate(drink);
        System.out.println(drink.getDesc());

        System.out.println("=============摩卡咖啡===============");
        // 初始化摩卡咖啡
        Drink obj  = new MochaCoffee();
        // 摩卡咖啡中添加 2分冰激凌
        obj = new IceCream(obj);
        obj = new IceCream(obj);
        System.out.println(obj.getDesc());
        // 摩卡咖啡中添加2份牛奶
        obj = new Milk(obj);
        obj = new Milk(obj);
        System.out.println(obj.getDesc());


    }
}
